<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="${pageContext.request.contextPath}/styly.css" type="text/css" rel="stylesheet"/>
        <title><spring:message code="employeelist.head"/></title>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
        <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
        <script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
        <script>
            $(function() {
                $( "#datepicker" ).datepicker({ dateFormat: "yy-mm-dd" ,changeYear: true ,yearRange: "1901:2013",constrainInput: false,changeMonth: true});
            });
        </script>
    </head>
    <body>
        <div class="wrapper">
            <div class="header"><h1> <spring:message code="employeelist.title"/> </h1></div>
            <div class="navig">
                <%@ include file="../navig.jsp" %>
            </div>    
            <div class="content">
                <div style="color: green;"><spring:message code="${infoMessage}"/></div>
                <div style="width: 60%;">
                    <h4><spring:message code="employeelist.nadpistabulky"/></h4>    
                    <form method="post" action="employeeAdd">
                        <div style="color: red;">
                            <spring:message code="${errMessage}"/>
                            <spring:message code="${errMessage1}"/>
                            <spring:message code="${errMessage2}"/>
                            <spring:message code="${errMessage3}"/>
                            <spring:message code="${errMessage5}"/>
                            <spring:message code="${errMessage6}"/>
                        </div>
                        <b><spring:message code="employeelist.meno"/></b> <input type="text" size="20" name="input1" /><br/>
                        <b><spring:message code="employeelist.priezvisko"/></b> <input type="text" size="30" name="input2" /><br/>
                        <b><spring:message code="employeelist.datumnarodenia"/></b><spring:message code="employeelist.formatdatumunarodenia"/> <input type="text" name="date" id="datepicker" /><br/>
                        <b><spring:message code="employeelist.username"/></b> <input type="text" size="30" name="input5" /><br/>
                        <b><spring:message code="employeelist.password"/></b> <input type="password" size="30" name="input6" /><br/>
                        <b><spring:message code="employeelist.spolocnost"/></b> <select name="input4">
                            <c:forEach items="${companies}" var="company" >
                                <option value="${company.id}">${company.name}</option>
                            </c:forEach>
                        </select><br/>
                        <b><spring:message code="employeelist.authority"/></b> <select name="input7">
                            <option value="1"><spring:message code="employeelist.user"/></option>
                            <option value="2"><spring:message code="employeelist.admin"/></option>
                        </select><br/>
                        <b><spring:message code="employeelist.enabled"/></b> <select name="input8">
                            <option value="1"><spring:message code="employeelist.yes"/></option>
                            <option value="2"><spring:message code="employeelist.no"/></option>
                        </select><br/>
                        <input type="submit" name="submit" value="<spring:message code="employeelist.submit"/>"  />
                    </form>
                    <br />
                    <div>
                        <form method="post" action="employeeFind">
                            <div style="color: red;" style="">
                                <spring:message code="${hladane}"/>
                            </div>
                            <b><spring:message code="employeelist.hladanepriezisko"/></b> <input type="text" size="30" name="hladanepriezvisko" /><br/>
                            <input type="submit" name="submit" value="<spring:message code="employeelist.hladat"/>"  />
                        </form>
                    </div>
                </div>
                <h3><spring:message code="employeelist.contentheader"/></h3>
                <table >
                    <tr class="head">
                        <td><b><spring:message code="employeelist.meno"/></b></td>
                        <td><b><spring:message code="employeelist.priezvisko"/></b></td>
                        <td><b><spring:message code="employeelist.datumnarodenia"/></b></td>
                        <td><b><spring:message code="employeelist.username"/></b></td>
                        <td><b><spring:message code="employeelist.password"/></b></td>
                        <td><b><spring:message code="employeelist.spolocnost"/></b></td>
                        <td><b><spring:message code="employeelist.enabled"/></b></td>
                        <td><b><spring:message code="employeelist.authority"/></b></td>
                        <td></td>
                        <td></td>
                    </tr>
                    <c:forEach items="${employees}" var="employee">
                        <tr>
                            <td><c:out value="${employee.name}" /></td>
                            <td><c:out value="${employee.surname}" /></td>
                            <td><c:out value="${employee.birthDate}" /></td>
                            <td><c:out value="${employee.username}" /></td>
                            <td><c:out value="${employee.password}" /></td>
                            <td><c:out value="${employee.company.name} " /></td>
                            <td><c:out value="${employee.enabled} " /></td>
                            <td><c:out value="${employee.authority} " /></td>
                            <td><a href="./employeeEditJSP/${employee.id}"><spring:message code="employeelist.upravit"/></a></td>
                            <td><a href="./employeeDelete?id=${employee.id}"><spring:message code="employeelist.zmazat"/></a></td>
                        </tr>
                    </c:forEach>   
                </table>    
            </div>
            <div class="footer">
                Team: Andrej Hraško, Ondřej Myška, Lukáš Slovák, Michal Polkoráb
            </div>
        </div>
    </body>
</html>
